package com.bkitmobile.kesu.android.GUI;

import com.bkitmobile.kesu.android.connectServer.Request;
import com.bkitmobile.kesu.android.connectServer.staticClass;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class SetStatus extends Dialog implements android.view.View.OnClickListener{
	
	EditText editText;
	Button ok, cancel;
	double longitude,latitude;
	public SetStatus(Context context,double longitude,double latitude) {
		super(context);
		setContentView(R.layout.state_status);
		this.longitude = longitude;
		this.latitude = latitude;
	}
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		this.editText = (EditText) findViewById(R.id.state_status);
		this.cancel = (Button) findViewById(R.id.state_cancel);
		this.ok = (Button) findViewById(R.id.state_ok);
		ok.setOnClickListener(this);
		cancel.setOnClickListener(this);
		setCancelable(true);
		setTitle(R.string.title_dialog_status);
	}
	
	public void show() {
		super.show();
		editText.setText("");
	}
	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		if(v == ok){
			//Request.sendAndRecieveData(identities, atributies, false);
			String request = "<status>"+editText.getText().toString()+"<long>"+longitude+"<lat>"+latitude;
			staticClass.socket.println(request);
		}
		dismiss();
	}

}
